-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MPLUGIN-495] WARNINGs based on usage of @Component for MavenSession/MavenProject instead of @Parameter #253
Conversation
We also have the same in |
.../apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java
Outdated
Show resolved
Hide resolved
Working on it. At some point (4.0.0) we should consider dropping support for Javadoc style, only annotation style should remain. |
…MavenProject instead of @parameter This closes #253
I jave just tried a snapshot against Maven Dependency Plugin as @khmarbaise has reported. I get:
I guess something is missing on the test classpath, but I have no idea what... |
…MavenProject instead of @parameter This closes #253
@cstamas Any ideas? |
OutOfScopeException of MavenSession. You used Maven 4.0.0-alpha-10? |
No, 3.8.8. |
Hm, with 3.9.6 it "works for me" |
Did you build a snapshot of this and apply it to Maven Dependency Plugin?
|
hm, nope, i assumed this PR fails to build.... |
It works, but not the subsequent use in tests. ITs do work, actually. So I guessed that some dep is missing during tests. |
Or unit test simply try to lookup Mojo without calling |
We can remove |
Parameter list can be null ... we also need a fix like: --- a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugins/plugin/descriptor/EnhancedPluginDescriptorBuilder.java
+++ b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugins/plugin/descriptor/EnhancedPluginDescriptorBuilder.java
@@ -21,9 +21,11 @@ package org.apache.maven.plugins.plugin.descriptor;
import java.io.Reader;
import java.net.URI;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.Parameter;
@@ -87,7 +89,8 @@ public class EnhancedPluginDescriptorBuilder extends PluginDescriptorBuilder {
PlexusConfiguration[] parameterConfigurations = c.getChild("parameters").getChildren("parameter");
- List<Parameter> parameters = new ArrayList<>(mojoDescriptor.getParameters());
+ List<Parameter> parameters = new ArrayList<>(
+ Optional.ofNullable(mojoDescriptor.getParameters()).orElseGet(Collections::emptyList));
Map<String, Parameter> parameterMap = new LinkedHashMap<>(mojoDescriptor.getParameterMap());
for (PlexusConfiguration d : parameterConfigurations) {
@@ -108,7 +111,9 @@ public class EnhancedPluginDescriptorBuilder extends PluginDescriptorBuilder {
}
// clear() is required for maven < 3.6.2
- mojoDescriptor.getParameters().clear();
+ if (mojoDescriptor.getParameters() != null) {
+ mojoDescriptor.getParameters().clear();
+ }
|
Thanks, working on this. I consider |
…MavenProject instead of @parameter This closes #253
…MavenProject instead of @parameter This closes #253
…MavenProject instead of @parameter This closes #253
I have changed the comment regarding 3.6.2 because that statement is wrong. |
If I don't hear any objections the next couple of days I will merge this PR and the one with the docs update. @slawekjaranowski's fix on MDEP can be applied to all affected plugins moving to MPLUGIN 3.11.0. |
…MavenProject instead of @parameter This closes #253
…MavenProject instead of @parameter This closes #253
Sorry for the late intervention. I'm not completely sure about discouraging the use of ${project.xxx} expressions. |
Both will continue to work, but if that is your concern can you file an issue regarding this, so it is not forgotten? |
This closes #253